﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using BLL_HealthInsurance;
using DTO_HealthInsurance;
using DAO_HealthInsurance;
namespace HealthInsuranceMgm.Admin
{
    public partial class Changepass : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            txtusername.Text = Session["username"].ToString(); 
        }
        public void message(string script)
        {

            Page.ClientScript.RegisterStartupScript(this.GetType(), "MyScript", script, true);
        }
       
        protected void btnchange_Click(object sender, EventArgs e)
        {
            DAOSecurityPassword seccu = new DAOSecurityPassword();
            
            BLLAdmin bll = new BLLAdmin();
            DTOAdminLogin dto = new DTOAdminLogin();
            if (txtoldpass.Text.Equals(Session["password"].ToString()))
            {

                dto.Password =seccu.EnCrypt( txtnewpass.Text).ToString();
                dto.UserName = Session["username"].ToString();
                bll.AdminChangePass(dto);
                message("alert('Change Password Successfull');");
            }
            else {
                message( " alert('Old password not Match!');");
            }
        }
    }
}